﻿using Spring.Context;
using Spring.Context.Support;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SpringFactory
{
    public static class SpringFactoryClass<T> where T : class
    {

        public static T GetObject(string name)
        {
            T result;
            try
            {
                IApplicationContext ctx = ContextRegistry.GetContext();
                result = ctx.GetObject(name) as T;
            }
            catch (Exception ex)
            {
                result = default(T);
            }
            return result;
        }

    }
}
